<%@page import="org.springframework.security.web.WebAttributes"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

<%@ page
	import="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter"%>
<%@ page
	import="org.springframework.security.core.AuthenticationException"%>



<div class="span-10 append-2 last">
	<form:form modelAttribute="user">
		<fieldset>
			<legend>Registration Information</legend>
			<div>
				<div class="span-4">
					<label for="username">User:</label>
				</div>
				<div class="span-7 last">
					<p>
						<form:input type="text" id="username" name="username" path="username" />
					</p>
					<script type="text/javascript">
							Spring.addDecoration(new Spring.ElementDecoration({
								elementId : "username",
								widgetType : "dijit.form.ValidationTextBox",
								widgetAttrs : { promptMessage : "Your username", required : true ,
									invalidMessage : "Username must be a 2-characters string at least.",
									regExp : "[a-zA-Z0-9]{2,}"}}));
						</script>

				</div>
			</div>
			<div>
				<div class="span-4">
					<label for="password">Password:</label>
				</div>
				<div class="span-7 last">
					<p>
						<form:input id="password" name="password" path="password" type="password" />
					</p>
					<script type="text/javascript">
							Spring.addDecoration(new Spring.ElementDecoration({
								elementId : "password",
								widgetType : "dijit.form.ValidationTextBox",
								widgetAttrs : { promptMessage : "Your password",
									required : true,
									invalidMessage : "Your password must be 6-character long and be composed of both digits and letters.",
									regExp : "(?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{6,40})$"  }}));
						</script>

				</div>
			</div>
			<div>
				<div class="span-4">
					<label for="name">Name:</label>
				</div>
				<div class="span-7 last">
					<p>
						<form:input type="text" id="name" name="name" path="name" />
					</p>
					<script type="text/javascript">
							Spring.addDecoration(new Spring.ElementDecoration({
								elementId : "name",
								widgetType : "dijit.form.ValidationTextBox",
								widgetAttrs : { promptMessage : "Your name", required : true }}));
						</script>

				</div>
			</div>
			<p>
				<button type="submit" id="proceed" name="_eventId_proceed">Register</button>
				<script type="text/javascript">
					Spring.addDecoration(new Spring.ValidateAllDecoration({event : 'onclick', elementId : 'proceed'}));
				</script>
			</p>
		</fieldset>
	</form:form>
</div>
